<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>list</title>
<#include "/admin/include/head.htm">
</head>
<body>
<script type="text/javascript">
    var grid;
    $(function () {
        grid = $("#maingrid").ligerGrid({
            columns: [
				{name: 'id', hide: true, width:0, isAllowHide: false},
	            {display: '名称', name: 'Path', align: 'center', width: 200},
				{display: '备份日期', name: 'Ctime', align: 'center', width: 200}
			],  
			pageSize:20, 
			url: base + '/admin/system/backup/queryAlbumData.jhtml',
			width: '100%', 
			height:'100%', 
			enabledSort: true,
			checkbox: true,
			toolbar:{
			}
        });
		
		$("#pageloading").hide();
		LG.loadToolbar(grid);
		//绑定搜索按钮
		LG.search(grid);
    });
	
	/**备份*/
	function backup() {
		$.ligerDialog.confirm('确定备份?', function (yes) { 
			if(yes) {
				LG.ajax({
					url: base + '/admin/system/backup/backupAlbum.jhtml',
				    loading: '正在备份中...',
				    success: function () {
						LG.showSuccess('备份成功');
				        f_reload();
				    },
				    error: function (message) {
						LG.showError(message);
				    }
				});
			} 
		});
	}
	
	/**相册还原*/
	function restore() {
		var selecteds = grid.getSelecteds();
	    if (selecteds.length == 1) {
	    	jQuery.ligerDialog.confirm('确定还原相册吗?', function (confirm) {
      			if (confirm){
					LG.ajax({
						url: base + '/admin/system/backup/restoreAlbum.jhtml',
			            loading: '相册还原中...',
			            data: {
							path:  grid.getSelected().Path,
						},
			            success: function () {
							LG.showSuccess('操作成功!');
			                f_reload();
			            },
			            error: function (message) {
							LG.showError(message);
			            }
			        });
			    }
			});
		} else if(selecteds.length > 1) {
			LG.tip('只能选择一行!');
		} else {
			LG.tip('请选择行!');
	    }
	}
</script>
</head>
<body style="padding:10px; overflow:hidden;">
	<div id="functions">
		<div class="clearfix">
			<div style="float:left;">
			</div>
		</div>
	</div>
	<div id="maingrid" style="margin:0; padding:0"></div>
</body>
</html>